package com.lxmes.web.api;

import com.lxmes.common.annotation.Log;
import com.lxmes.common.core.controller.BaseController;
import com.lxmes.common.core.domain.AjaxResult;
import com.lxmes.common.core.page.TableDataInfo;
import com.lxmes.common.enums.BusinessType;
import com.lxmes.system.domain.*;
import com.lxmes.system.service.*;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 门户网站API
 *
 * @author zhangzy
 * @date 2019-08-29 21:27:33
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/mhwz/api")
public class MhWzApi extends BaseController {
    @Autowired
    private IMhColumnNavigationService mhColumnNavigationService;
    @Autowired
    private IMhColumnTypeService mhColumnTypeService;
    @Autowired
    private IMhCompanyInfoService mhCompanyInfoService;
    @Autowired
    private IMhInformationService mhInformationService;
    @Autowired
    private IMhMessagesBoardService mhMessagesBoardService;

    //获取栏目
    @GetMapping("/getLm")
    public AjaxResult getLm(MhColumnNavigation mhColumnNavigation)
    {
        mhColumnNavigation.setIsEnabled("1");
        List<MhColumnNavigation> list = mhColumnNavigationService.selectMhColumnNavigationList(mhColumnNavigation);
        return AjaxResult.success(list);
    }
    //获取栏目类型
    @GetMapping("/getLmLx")
    public AjaxResult getLmLx(MhColumnType mhColumnType)
    {
        mhColumnType.setIsEnabled("1");
        List<MhColumnType> list = mhColumnTypeService.selectMhColumnTypeList(mhColumnType);
        return AjaxResult.success(list);
    }
    //获取公司信息
    @GetMapping("/getGsInfo")
    public AjaxResult list(MhCompanyInfo mhCompanyInfo)
    {
        List<MhCompanyInfo> list = mhCompanyInfoService.selectMhCompanyInfoList(mhCompanyInfo);
        return AjaxResult.success(list);
    }
    //获取网站信息
    @GetMapping("/getWzXx")
    public AjaxResult list(MhInformation mhInformation)
    {
        List<MhInformation> list = mhInformationService.selectMhInformationList(mhInformation);
        return AjaxResult.success(list);
    }
    //在线浏览
    @PostMapping("/addMessagesBoard")
    public AjaxResult add(@RequestBody MhMessagesBoard mhMessagesBoard)
    {
        return toAjax(mhMessagesBoardService.insertMhMessagesBoard(mhMessagesBoard));
    }
}
